package pl.mcnova.view.filters;

import pl.mcnova.model.entity.Mail;
import pl.mcnova.model.table.MailTableModel;

public class MailFilter extends DateFilter {

	public MailFilter(Long min, Long max) {
		super(min, max);

	}

	@Override
	public boolean include(javax.swing.RowFilter.Entry<? extends Object, ? extends Object> entry) {
		MailTableModel model = (MailTableModel) entry.getModel();
		Mail mail = model.get((Integer) entry.getIdentifier());

		if (mail == null) return false;
		if (mail.getDate() < min || mail.getDate() > max) return false;

		return true;
	}
}
